function init_pmtsent() {
	pmt_sent_cache = null;
	if(pmts_yui_table_instance == null){
		//For now, create and show yui table.
		create_pmtseceived_yui_table();
		}
		clear_pmtseceived_yui_table();
		
		var dwrCallMetaData = {
				callback : success_fetchpmtsent,
				exceptionHandler : exception_generic_handler,
				timeout : 100000,
				errorHandler : exception_generic_handler
			};
		
		if(usr_comp_cache == null) {setTimeout(init_pmtsent, 1000); return;}
		
		DWR_Invoice.fetchPaymentsSent(usr_comp_cache.companyId,dwrCallMetaData);
	
}
var pmt_sent_cache = null;
function success_fetchpmtsent(dwrresp){
	clear_pmtseceived_yui_table();
	if(dwrresp.objRespOrError != null && dwrresp.objRespOrError.length > 0){
		pmt_sent_cache = dwrresp.objRespOrError;
		pmts_yui_table_instance.addRows(dwrresp.objRespOrError);
	}
}

var pmts_yui_table_instance = null;
function create_pmtseceived_yui_table() {
	if(pmts_yui_table_instance == null){
	var pmtscolumnDefs = [ {
		key : "selectThis",
		label : "Select",
		formatter : "radio",
		sortable : false,hidden:true
	},
	                       
	                       {
		key : "paymentNumber",
		label : "Payment#",
		formatter: "hlinkFormatter",
		sortable : true
	}/*, {
		key : "clientNameText",
		label : "Buyer",
		sortable : true
	}*/, {
		key : "paymentSubmittedDate",
		label : "Payment Date",
		formatter: "date",
		sortable : true
	}/* , {
		key : "purchaseOrderNumber",
		label : "PO#"
	}*/, {
		key : "totalPaymentAmount",
		label : "Buyer Amount",
		formatter: "currency"
	} /*, {
		key : "status",
		label : "Order Status",
		sortable : true
	} ,{
		key : "attachment",
		label : "Attachment",
		sortable : true,
		formatter : customAttachmentFormatter
	} */];

	var pmtsDataSource = new YAHOO.util.DataSource();
	pmtsDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
	 var oConfigs = {
             paginator: new YAHOO.widget.Paginator({
                 rowsPerPage: 2
                 
             }),
             initialRequest: "results=504",
             width: "600px",
             // we'll leave the actual loading for later
 			initialLoad:true, 
 				
 			// This function links the master to the nested tables
 			generateNestedRequest: function (record) {
 				return lineItemData;

 			}
     };
	 /*por_yui_table_instance = new YAHOO.widget.NestedDataTable(
				'poreceived_yui_table', 
				porcolumnDefs,
				porDataSource,
				lineItemReadOnlycolumnDefs,
				lineItemDataSource,
				oConfigs);*/
	 pmts_yui_table_instance = new YAHOO.widget.DataTable("pmtsent_yui_table",pmtscolumnDefs,pmtsDataSource,oConfigs);
	 pmts_yui_table_instance.set("selectionMode", "single");
	 pmts_yui_table_instance.subscribe("rowClickEvent",
			 pmts_yui_table_instance.onEventSelectRow);
	//por_yui_table_instance.subscribe("nestedToggleEvent",additemsr_tonested); 
	}

}

function clear_pmtseceived_yui_table() {
	if (pmts_yui_table_instance != null) {
		var length = pmts_yui_table_instance.getRecordSet().getLength();
		if (length > 0) {
			pmts_yui_table_instance.deleteRows(0, length);
		}
	}
}